﻿#Question 3
#Creating the OU Comedians
$objOU=[ADSI]"LDAP://DC=example,DC=com"
$objCreate=$objOU.Create("OrganizationalUnit","ou=Comdians")

#Setting the Informaation to AD to create the OU
$objCreate.setInfo()

#Creating OU inside the OU Comedians to create the Users
$objDomain=[ADSI]"LDAP://ou=Laughter,DC=Comedians"

#Creating Users
$objUser1=$objCreate.Create("User","CN=Seinfield")
$objUser2=$objCreate.Create("User","CN=Steve")
$objUser3=$objCreate.Create("User","CN=Barry")
$objUser4=$objCreate.Create("User","CN=Judith")

#Setting the Information of the Users

$objUser1.setInfo()
$objUser2.setInfo()
$objUser3.setInfo()
$objUser4.setInfo()

#Putting the Information to the Users
#For the Street Address
$objUser1.Put("streetAddress","Swanston Street")
$objUser2.Put("streetAddress","Russell Street")
$objUser3.Put("streetAddress","Flinders Street")
$objUser4.Put("streetAddress","Collins Street")

#For the P.O. Box Number
$objUser1.Put("postOfficeBox","1")
$objUser2.Put("postOfficeBox","2")
$objUser3.Put("postOfficeBox","3")
$objUser4.Put("postOfficeBox","4")

#For City
$objUser1.Put("l","Perth")
$objUser2.Put("l","Perth")
$objUser3.Put("l","Melbourne")
$objUser4.Put("l","Melbourne")

#For Country
$objUser1.Put("co","United States")
$objUser2.Put("co","United States")
$objUser3.Put("co","Australia")
$objUser4.Put("co","Australia")

$objUser1.setInfo()
$objUser2.setInfo()
$objUser3.setInfo()
$objUser4.setInfo()

#Printing the completion for this Task
Write-Host ""
Write-Host "#############################################"
write-Host "Organizational Unit has been Created"
Write-Host ""
write-Host "Users has been added to Organizational Unit"
Write-Host "#############################################"
Write-Host ""




